package flc.ast.adapter;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import flc.ast.R;
import flc.ast.bean.MyInstructionBean;
import flc.ast.bean.MyOilBean;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.basic.adaptermutil.StkSingleSpanProvider;

public class InstructionAdapter extends StkProviderMultiAdapter<MyInstructionBean> {

    public InstructionAdapter() {
        addItemProvider(new StkSingleSpanProvider<>(40));
        addItemProvider(new InstructionProvider());
    }

    private class InstructionProvider extends BaseItemProvider<MyInstructionBean> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_instruction;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, MyInstructionBean bean) {
            baseViewHolder.setText(R.id.tvInstructionItemCity,bean.getCity());
            baseViewHolder.setText(R.id.tvInstructionItemDesc,bean.getDesc());
            baseViewHolder.setImageResource(R.id.ivInstructionItemImg,bean.getImg());
            if (baseViewHolder.getBindingAdapterPosition()==4){
                baseViewHolder.setVisible(R.id.ivInstructionItemMore,false);
            }else {
                baseViewHolder.setVisible(R.id.ivInstructionItemMore,true);
            }
        }
    }

}
